<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
var str = '字符串';
// alert(str);
// console.log(str);

var num = 10;
// console.log(num);

var i = 0;
i++;   //i = i + 1;   先执行后运算
console.log(i);   //1
++i;   //i = i + 1;   先运算后执行
console.log(i);   //2

var sum = 0;
sum = i++ + ++i;  //2 + 4
console.log(sum);

sum = i-- - i-- + i-- - --i;  //4 - 3 + 2 - 0
console.log(sum);

var array = [1,2,3,'4','5','第六'];
console.log(array[0]);
console.log(array[1]);
console.log(array[2]);
console.log(array[3]);
console.log(array[4]);
console.log(array[5]);
console.log(array.length)
for (var i = 0; i < array.length; i++) {
    console.log(array[i]);
}

var person = {name:'谢文壮',age:'18岁',height:'160cm',weight:'88kg',sex:'未知'};
console.log(person.name);
console.log(person.name + ',年龄：' + person.age + ',身高：' + person.height  + ',体重：' + person.weight + ',性别：' + person.sex);


var examplearr=[8,94,15,88,55,76,21,39];
function sortarr(arr){
    for(i=0;i<arr.length-1;i++){
        for(j=0;j<arr.length-1-i;j++){
            if(arr[j]>arr[j+1]){
                var temp=arr[j];
                arr[j]=arr[j+1];
                arr[j+1]=temp;
            }
        }
    }
    return arr;
}
sortarr(examplearr);
console.log(examplearr);
</script>
</html>